﻿@model BrnMall.Web.StoreAdmin.Models.ShipConfigModel
@section header{
	<title>配送信息-配送管理</title>
	<link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
	<link type="text/css" rel="stylesheet" href="/components/jquery_tips/tipso.min.css">
	<script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
	<script type="text/javascript" src="/admin_store/scripts/showlist.js"></script>
	<link rel="stylesheet" type="text/css" href="/components/jbox/Skins/Default/jbox.css" />
	<script type="text/javascript" src="/components/jquery_tips/tipso.min.js"></script>
	<script type="text/javascript" src="/components/jbox/jquery.jBox-2.3.min.js"></script>
	<script type="text/javascript" src="/admin_store/scripts/selectlist.js"></script>
	<style>
	input[type=text] { padding-left :5px;}
    .tips {border-bottom:none}
	</style>
<script>
    $(function () {
        /*鼠标移动的提示*/
        $('.tips').tipso({ useTitle: false, background: '#ff8427' });
        $(".rad").click(function () { changeFee($(this)) });
        load();
    });

    function load() {
        var money = $("#ShipMoney").val();
        if (money != '' && parseInt(money) > 0){
            $("#ShipMoney").val(parseInt(money));
            $("#rad1").click();
        }
        else {
            $("#ShipMoney").val("0");
            $("#rad0").click();
        }
    }

    function changeFee(obj) {
        if (obj.attr("id") == "rad1")
            $(".fee-box").css("display", "");
        else
            $(".fee-box").css("display", "none");
    }

    function submits() {
        var money = $("#ShipMoney").val();
        var rad = document.getElementById("rad0");

        if (isNaN(money)) {
            $.jBox.tip('金额必须是数字！');
            return false;
        }
        if (rad.checked) {
            $("#ShipMoney").val("0");
        }
        else {
            if (parseFloat(money) < 1 || parseInt(money) < parseFloat(money)) {
                $.jBox.tip('金额必须是大于0的整数！');
                return false;
            }
        }
        return true;
    }
</script>
}
@section body{
	<h1 class="rightH1">
		微信小程序 &gt; 餐饮外卖 &gt; <span class="rightH1-cur">配送设置</span>
		<div class="right">
			<div class="clear"></div>
		</div>
		<div class="clear"></div>
	</h1>

	@using (Html.BeginForm())
	{
		@Html.HiddenFor(x => x.Id);
		@Html.HiddenFor(x => x.StoreId)
	<div class="addTable">
		<table width="100%">
			<tr>
				<td align="right" style="width:120px;">自动配送：</td>
				<td>@Html.RadioButtonFor(x => x.IsAutoShip, 0)
					<span class="tips" style="border-bottom:0px;margin-right:28px" data-tipso="手动配送：会员支付后，商户需要到订单列表中自己完成配送操作">
						手动
					</span>  &nbsp; &nbsp; &nbsp;
				 @Html.RadioButtonFor(x => x.IsAutoShip, 1) 
					<span class="tips" style="border-bottom:0px;" data-tipso="自动配送：会员支付后，系统自动将订单推送到达达配送，配送余额不足时，此功能会停用">
						自动
					</span>
				</td>
			</tr>
			<tr>
				<td align="right">配送最大距离：</td>
				<td>@Html.TextBoxFor(x => x.MaxDistance) 公里 @Html.ValidationMessageFor(x => x.MaxDistance) </td>
			</tr>
			<tr>
				<td align="right">配送费用：</td>
                <td>
                    <input type="radio" id="rad0" name="rad" value="0" class="rad" checked="checked" /> 
                    <label for="rad0" class="tips"  style="margin-right :25px;" data-tipso="达达计费：按照达达配送的收费标准计费，具体的计费标准，请查看达达官方文档">达达计费</label>
                    <input type="radio" id="rad1" name="rad" value="1" class="rad" /> 
                    <label for="rad1" class="tips" data-tipso="自定义费用：商户设置>=1元 的配送费，会员买单时，按商户设置的金额收取配送费">自定义费用</label>
                    <span class="fee-box" style="display:none; padding-left:10px;">  @Html.TextBoxFor(x => x.ShipMoney, new { style = "width:60px" })  元 @Html.ValidationMessageFor(x => x.ShipMoney)</span>
                </td>
			</tr>
			<tr>
				<td></td>
				<td><a><button type="submit" class="button" onclick="return submits()">提交</button></a></td>
			</tr>
		</table>
	
	</div>
	}
}